home *** CD-ROM | disk | FTP | other *** search
Text File | 1998-03-19 | 24.9 KB | 677 lines | [TEXT/MPS ] |
- #
- # ****************************************************************************
- #
- # File Name: TimingOperations.lib
- #
- # Contains: Higher level timing routines
- #
- # Written by: KTA
- #
- # Copyright: © 1993-1996 by Apple Computer, Inc., all rights reserved.
- #
- # ****************************************************************************
- # C h a n g e H i s t o r y (most recent first):
- # ****************************************************************************
- #
- # Vers Date Author Description
- # ---- -------- ------ ---------------------------------------------
- # <13> 5/1/96 MDF Removed call to SwitchScriptBackToOrig() in TimeSaveAs() and
- # TimeOpenFile(), per Intl request.
- # <12> 2/28/95 ML marked
- # <11> 2/14/95 KTA SetUpDocumentWindow() - Added BooleanFlag to FindWindow() call
- # <10> 1/31/95 ML add IvyOperations.Lib to declaration, change all ivy calls to
- # _Ivy calls
- # <9> 1/19/95 KTA Changed the name of ExceptionHandler() to ExceptionDispatcher().
- # <8> 12/6/94 ML Added Exception Handling support
- # <7> 6/28/94 ML PerformScroll() - return returnval# ML 6/28/94 call
- # PerformScroll() multiple times and increment pWaitForScroll
- # # if it isn't long enough
- # <6> 6/2/94 ML Enhanced TimeScrolling() and PerformScrolling() for Thumbnail
- # method and ScrollByScreen option.
- # <5> 4/27/94 KTA TimeFontTesting() - Added patience.
- # <4> 4/19/94 ML Make libraries declaration one line, move SaveAsPerformance,
- # OpenFilePerformance, and SF_Stoptimer to TimingSFDialog.Lib
- # <3> 4/18/94 ML Revved libraries declaration to "Ivy.vulib" from Ivy.1.1.vulib",
- # revised globals declaration in StopTimerIV(), removed
- # gOpenFileHook1 assigment in TimeOpenFile() and gSaveAsHook1,
- # gSaveAsHook3 assignments in TimeSaveAs().
- # <2> 4/15/94 KTA Added check to insure that IV initialized correctly.
- # <1> 4/12/94 ML Moved into Libraries project from Timing project
- # <1.0.5> 4/12/94 ML Added OpenFilePerformance(), SaveAsPerformance(),
- # SF_StopTImer(). Replace stoptimer() w/stoptimerVU(), remove
- # gTiming, removed TimeOpenFileVU, TimeSaveAsVU. TimeCutPaste()
- # -add IVInit and IVQuit. TimeSaveAs - add IVInit and IVQuit.
- # TimeOpenFile - add IVInit and IVQuit.
- #
- #
- # <1.0.4> 12/1/93 KTA TimeSaveAs() and TImeOpenFile() now call a new task,
- # GetFirstTwoMenusRect(), to determine when they are completed.
- # <1.0.3> 11/22/93 KTA SetUpDocumentWindow() now calls findWindow so we can pass a
- # variety of specifiers
- # <1> 11/16/93 KTA Created
- #
- # ****************************************************************************
- #
-
-
- ########################################################################
- # External libraries
- #=======================================================================
- Libraries "UserInterface.lib", "Font.Lib", "Ivy.vulib", "TimingBasics.Lib",
- "StandardFile.Lib", "WorldReady.Lib", "Output.Lib", "ExceptionHandling.Lib",
- "IvyOperations.Lib";
-
- #########################################################################
- # GetProcessListIconRect()
- #=======================================================================
- # Author: KTA
- # Description: Returns the rect of the application icon for the process list menu.
- # Parameters: none
- # Returns: Returns the rect of the application icon for the process list menu.
- # Example: GetProcessListIconRect();
- # Assumptions Processlist is the farthest menu to the right.
- #=======================================================================
- # History:
- # ML 11/29/94 Added Exception Handling support
- #########################################################################
- TASK GetProcessListIconRect()
- begin
- try match[screen m:true r:?ScreenRect];
- catch theError
- ExceptionDispatcher(theError);
- LeftPoint := ScreenRect[3]-34;
- theAppIconRect := {LeftPoint,0,LeftPoint+16,ScreenRect[2]+18};
- Return(theAppIconRect);
- end;
- #########################################################################
- # GetAppleMenuIconRect()
- #=======================================================================
- # Author: KTA
- # Description: Returns the rect of the Apple icon for the Apple menu.
- # Parameters: none
- # Returns: Returns the rect of the Apple icon for the Apple menu.
- # Example: GetAppleMenuIconRect();
- # Assumptions Apple menu is the farthest menu to the left.
- #=======================================================================
- # History:
- # ML 11/29/94 Added Exception Handling support
- #########################################################################
- TASK GetAppleMenuIconRect()
- begin
- try match[screen m:true r:?ScreenRect];
- catch theError
- ExceptionDispatcher(theError);
- LeftPoint := ScreenRect[1]+16;
- theAppIconRect := {LeftPoint,0,LeftPoint+16,ScreenRect[2]+18};
- Return(theAppIconRect);
- end;
- #########################################################################
- # GetFirstTwoMenusRect()
- #=======================================================================
- # Author: KTA
- # Description: Returns the rect of the Apple menu and the file menu
- # Parameters: none
- # Returns: Returns the rect of the Apple menu and the file menu.
- # Example: GetFirstTwoMenusRect();
- # Assumptions .
- #=======================================================================
- # History:
- # ML 11/29/94 Added Exception Handling support
- #########################################################################
- TASK GetFirstTwoMenusRect()
- begin
- try match[screen m:true r:?ScreenRect];
- catch theError
- ExceptionDispatcher(theError);
- LeftPoint := ScreenRect[1]+16;
- theMenusRect := {LeftPoint,0,LeftPoint+60,ScreenRect[2]+18};
- Return(theMenusRect);
- end;
-
- #########################################################################
- # TimeCutPaste()
- #=======================================================================
- # Author: KTA
- # Description: Will cut and paste the entire contents of a document and time how long
- # the operations take.
- # Parameters: pNumTimes - number of times to time the operation.
- # Returns: nothing
- # Example: TimeCutPaste();
- # Assumptions : Requires 'STOP' tag at bottom of document in Geneva, 12 point, plain
- # Also requires :
- # keyEq('a') will select all
- # keyEq('x') will cut
- # keyEq('v') will paste
- # and that pasting will display the end of the document
- # (where 'Stop' should exist).
- #=======================================================================
- # History:
- # ML 3/31/94 Add IVInit and IVQuit
- # KTA 4/15/94 Added check to insure that IV initialized correctly
- # ML 11/29/94 Added Exception Handling support
- # ML 1/31/95 Use _Ivy calls
- #########################################################################
- TASK TimeCutPaste(pNumTimes := 1)
- begin
- if (InitIvy())
- begin
- KeyEq('a'); # Select All
- KeyEq('x'); # Cut
- wait(2);
- if(DialogCheck('',1)) # probably out of memory
- begin
- Println "NOTE:!@#$% Cannot complete timing of CUT and Paste";
- return(0);
- end;
- KeyEq('v'); # Paste
- LogStr("##### We've reset the Document");
-
- try match[window o:1 r:?theRect];
- catch theError
- ExceptionDispatcher(theError);
- waitingRect := LocateTheString(theRect);
- #println "This is the WaitingRect - ", waitingRect;
- _Ivy(task IVCreateImageFile, {"Stop", waitingRect});
-
- KeyEq('a'); # Select All
- KeyEq('x'); # Cut
- _Ivy(task IVCreateImageFile, {"NoStop", waitingRect});
- KeyEq('v'); # Paste
-
- LogStr("###### Doing the Timing Thing");
- InstallIVTimingMethod();
- for i := 1 to pNumTimes
- begin
- global gImageFile:= "NoStop";
- global gRect := waitingRect;
- KeyEq('a'); # Select All
- global gTimedEvent := {1,"Cut contents of document"};
- KeyEq('x'); # Cut
- StopTimerIV();
- global gImageFile:= "Stop";
- global gRect := waitingRect;
- global gTimedEvent := {2,"Paste contents of document"};
- KeyEq('v');
- StopTimerIV();
- end;
- _Ivy(task IVDeleteImageFile, {"Stop"});
- _Ivy(task IVDeleteImageFile, {"NoStop"});
- RemoveIVTimingMethod();
- QuitIvy();
- end;
- else
- begin
- println "Problem initializing IV";
- exit;
- end;
- end;
-
- #########################################################################
- # TimeSaveAs(pFileName, pSaveMI)
- #=======================================================================
- # Author: KTA
- # Description: Sets up the requirements for timing utilizing IVY and times
- # how long it takes an application to save a file. Then removes
- # the all global varibles that are defined in order to do timing.
- # Parameters: pFileName - FileName for the document you want to save.
- # pSaveMI - 'Save As…' menuitem descriptor (ordinality contained in a list)
- # Returns: Nothing
- # Example: TimeSaveAs('@TestDoc', {7,2});
- # Assumptions Processlist is the farthest menu to the right.
- #=======================================================================
- # History:
- # ML 3/31/94 Add IVInit and IVQuit
- # KTA 4/15/94 Added check to insure that IV initialized correctly
- # ML 4/18/94 removed gSaveAsHook1, gSaveAsHook3 definitions
- # ML 1/31/95 Use _Ivy calls
- # MDF 04/30/96 Removed SwitchScriptBackToOrig() as it will be done
- # by gSaveAsHook3, per Intl request.
- #########################################################################
- TASK TimeSaveAs(pFileName := '',pSaveMI := {8,2})
- begin
- if(InitIvy())
- begin
-
- ### Hooks to time StandardFile
- global gSaveAsHook2 := task StopTimerIV;
-
- #### SaveAs
- theRect := GetFirstTwoMenusRect();
- _Ivy(task IVCreateImageFile, {"testImage", theRect});
- global gImageFile:= "testImage";
- global gRect := theRect;
- global gTimedEvent := {3,"Saving File", "{pFileName}"};
- InstallIVTimingMethod();
- SwitchScriptToUS(); # All standardFile operations are going to happen in english
-
- SaveAs(pFileName,,pSaveMI);
-
- RemoveIVTimingMethod();
-
- _Ivy(task IVDeleteImageFile, {"testImage"});
- QuitIvy();
-
- ### Remove hooks to time StandardFile
- global gSaveAsHook2 := 0;
- end;
- else
- begin
- println "Problem initializing IV";
- exit;
- end;
- end;
-
- #########################################################################
- # TimeOpenFile(pFileName, pOpenMI)
- #=======================================================================
- # Author: KTA
- # Description: Sets up the requirements for timing utilizing IVY and times
- # how long it takes an application to open a file. Then removes
- # the all global varibles that are defined in order to do timing.
- # Parameters: pFileName - FileName for the document you want to save.
- # pOpenMI - 'Open' menuitem descriptor (ordinality contained in a list)
- # Returns: Nothing
- # Example: TimeOpenFile('@TestDoc', {2,2});
- # Assumptions Processlist is the farthest menu to the right.
- #=======================================================================
- # History:
- # ML 3/31/94 Add IVInit and IVQuit
- # KTA 4/15/94 Added check to insure that IV initialized correctly
- # ML 4/18/94 removed global gOpenFileHook1 definitions
- # ML 1/31/95 Use _Ivy calls
- # MDF 04/30/96 Removed SwitchScriptBackToOrig() since script should always
- # be "U.S.", per Intl request.
- #########################################################################
- TASK TimeOpenFile(pFileName := '', pOpenMI := {2,2})
- begin
- if (InitIvy())
- begin
- ### Hooks to time StandardFile
- global gOpenFileHook2 := task StopTimerIV;
-
- ### OpenFile
- theRect := GetFirstTwoMenusRect();
- _Ivy(task IVCreateImageFile, {"testImage", theRect});
- global gImageFile:= "testImage";
- global gRect := theRect;
- global gTimedEvent := {4,"Opening File","{pFileName}"};
-
- SwitchScriptToUS(); # All standardFile operations are going to happen in english
- InstallIVTimingMethod();
-
- openFile(pFileName, pOpenMI);
-
- RemoveIVTimingMethod();
-
- _Ivy(task IVDeleteImageFile, {"testImage"});
- QuitIvy();
-
- ### Remove Hooks to time StandardFile
- global gOpenFileHook2 := 0;
- end;
- else
- begin
- println "Problem initializing IV";
- exit;
- end;
- end;
-
- #########################################################################
- # TimeFontTesting(numTimes, pFontRecord)
- #========================================================================
- # Author: KTA
- # Description: Times the selection of Fonts, Sizes and Styles. Normally this
- # task will be called after all text has been selected.
- # Parameters: numTimes - number of times to perform the timed tests.
- # pFontRecord - (optional) makes it possible to pass in a
- # fontRecord to define which fonts, sizes and styles
- # will be selected and therefore timed. FontRecords
- # take the following form:
- # {'FontName', 'SizeName',{'StyleName1', 'StyleName2', etc}}
- # Returns: nothing
- # Example: TimeFontTesting(4, {'Times', '12',{'Bold', 'Italics'}});
- # TimeFontTesting(2, );
- # Assuptions: a
- #========================================================================
- # History:
- # KTA 11/1/93 Created
- # ML 3/31/94 revised gTimedEvent for TCS info, removed gTiming
- # KTA 4/27/94 Added patience
- #########################################################################
- TASK TimeFontTesting(numTimes := 1, pFontRecord := {})
- begin
- global gCurrFontMenu, gFontList, gFontStyleList, gFontSizeList, gTimedEvent;
- Println "The gFontList := ", gFontList;
- Println "The gFontSizeList := ", gFontSizeList;
- Println "The gFontStyleList := ", gFontStyleList;
- InstallVUTimingMethod();
- tempPatience := patience(3);
-
- for i := 1 to numTimes
- begin
- if (pFontRecord)
- theFontRecord := pFontRecord;
- else
- theFontRecord := RandomFontRecords();
-
- println "Current FontRecord - ", theFontRecord;
- ## Start with fonts
- if not(global gCurrFontMenu) # Menu(s) which contain the menu item
- begin
- gCurrFontMenu := FindMenu(global gFontList[1]);
- if not(gCurrFontMenu) # Menu(s) which contain the menu item
- gCurrFontMenu := FindMenu("Chicago");
- end;
- currFontName := theFontRecord[1];
- gTimedEvent := {5,"Select Font","{currFontName}"};
- SelectmenuItem(theFontRecord[1], gCurrFontMenu[1], gCurrFontMenu[2]);
- StopTimerVU();
-
- ## Sizes
- if not(global gCurrSizeMenu) # Menu(s) which contain the menu item
- gCurrSizeMenu := FindMenu(global gFontSizeList[1]);
-
- currSize := theFontRecord[2];
- gTimedEvent := {6,"Select Size", "{currSize}"};
- SelectmenuItem(theFontRecord[2], gCurrSizeMenu[1], gCurrSizeMenu[2]);
- StopTimerVU();
-
- ## Styles
- if not(global gCurrStyleMenu) # Menu(s) which contain the menu item
- begin
- if (global gFontStyleList[1])
- gCurrStyleMenu := FindMenu(global gFontStyleList[1]);
- if not(gCurrStyleMenu) # Help insure that it is initilized correctly
- gCurrStyleMenu := FindMenu('Bold');
- end;
-
- for each currentStyle in theFontRecord[3] # For all the Styles
- begin
- gTimedEvent := {7,"Selecting a Style","{currentStyle}"};
- SelectmenuItem(currentStyle, gCurrStyleMenu[1], gCurrStyleMenu[2]);
- StopTimerVU();
- end;
- end;
- patience(tempPatience);
- RemoveVUTimingMethod();
- end;
-
- #########################################################################
- # SetUpDocumentWindow()
- #========================================================================
- # Author: MDS
- # Description: Positions the title bar of a document at location {0,20}
- # and resizes the document to aconstant size.
- # (according to the main screen size)
- # Assumtions: the document window is the top window (ordinality: 1)
- # Parameters: pWindowTitle - Title of the docuemnt to resize
- # Returns: nothing
- # Example:
- #========================================================================
- # History:
- # ML 11/29/94 Added Exception Handling support
- # KTA 2/14/95 Added BooleanFlag to FindWindow() call
- #########################################################################
- task SetUpDocumentWindow(pWindowTitle,pTopScreenLocation := {0,20})
- begin
- returnVal := 0;
- try match [screen m:true r:?MainScreenRect];
- catch theError
- ExceptionDispatcher(theError);
-
- # Index of screen coordinates list
- kLeft := 1; kTop := 2; kRight := 3; kBottom := 4;
-
- kDocWidth := MainScreenRect[kRight] - 70; # Calculate Doc W and H accordint to
- kDocHeight := MainScreenRect[kBottom] - 50; # the main screen size
-
- if (findWindow(pWindowTitle, true))
- begin
- DragWindow(pTopScreenLocation[1], pTopScreenLocation[2], 1, 1); # drag window to the top-left of the screen
- SizeWindow(kDocWidth, kDocHeight, 1, 1); # size window to constant coordinates
- returnVal := 1;
- end;
-
- return(returnVal);
- end; # SetUpDocumentWindow();
-
- #########################################################################
- # PerformScroll( pEndPointRect, pWhichDirection := 1)
- #========================================================================
- # Author: MDS
- # Description: Uses Ivy to time how long it takes to scroll a document from
- # top to bottom or viceversa
- # Parameters: pDocumentName - name of the document in which to time scrolling
- # pEndPointRect - list with the points of the rectangle containing
- # an image of the end point string
- # pWhichDirection - in which direction to time scrolling:
- # 0 - Up, 1 - Down
- # pWaitForScroll - Time to wait with scroll arrow held down Note:
- # this should be longer than the scroll should take
- # so IVY has time to locate the image.
- # pScrollByLine - whether to scroll line by line or screen by screen
- # 1 - line by line
- # 0 - screen by screen
- # pScrollCoords - 2 element list of coordinates of scroll point
- # Returns: The actual time that takes to scroll
- # Example:
- # Assumptions: 1- The document contains a string which indicates the end point
- # 2- The string should be created with at least one space at the
- # begining and one space at the end, otherwise the cursur beam
- # will prevent Ivy from locating the end point string.
- #
- #========================================================================
- # History:
- # ML 5/27/94 add pDocumentName, pScrollByLine, pScrollCoords
- # ML 5/27/94 add option to scroll by line or screen
- # defined different test cases
- # ML 6/28/94 return returnval
- # ML 11/29/94 Added Exception Handling support
- #########################################################################
- task PerformScroll( pDocumentName, pEndPointRect, pWhichDirection, pWaitForScroll,
- pScrollByLine, pScrollCoords)
- begin
- returnval := 0;
- if ( pWhichDirection = 0 ) # Scroll up
- topOrBottom := 1; # where to scroll in the doc window (1 = Start at Bottom)
- else # Scroll down
- topOrBottom := 0; # where to scroll in the doc window (0 = Start at top)
-
- # Position the Thumb at the top or Bottom of the document
- if (global gScrollWindow) # hook for Apps that don't scroll normally
- Call( gScrollWindow, 'V', topOrBottom, 1 );
- else
- ScrollWindow('V', topOrBottom, 1 );
-
- if pWhichDirection # if scroll down
- begin
- if pScrollByLine # if scroll by line
- logstr ("Moving pointer to the down arrow");
- else # else scroll by screen
- logstr ("Moving pointer to the scroll area above the down arrow");
- end; # if pWhichDirection
- else # else scroll up
- begin
- if pScrollByLine # if scroll by line
- logstr ("Moving pointer to the up arrow");
- else # else scroll by screen
- logstr ("Moving pointer to the scroll area below the up arrow");
- end; # scroll up
-
- scrollingPoint := { pScrollCoords[1], pScrollCoords[2] };
- _move ('a', scrollingPoint); # Position mouse on top of Scrolling Arrow
- # move a:scrollingArrow; # Position mouse on top of Scrolling Arrow
-
- if pWhichDirection # if scroll down
- begin
- if pScrollByLine # if scroll by line
- begin
- global gTimedEvent := {9,"Scrolling down by line", "'{pDocumentName}'"};
- logstr ("Scrolling down line by line");
- end;
- else # else scroll by screen
- begin
- global gTimedEvent := {10,"Scrolling down by screen", "'{pDocumentName}'"};
- logstr ("Scrolling down screen by screen");
- end;
- end; # if pWhichDirection
- else # else scroll up
- begin
- if pScrollByLine # if scroll by line
- begin
- global gTimedEvent := {11,"Scrolling up by line", "'{pDocumentName}'"};
- logstr ("Scrolling up line by line");
- end;
- else # else scroll by screen
- begin
- global gTimedEvent := {12,"Scrolling up by screen", "'{pDocumentName}'"};
- logstr ("Scrolling up screen by screen");
- end;
- end; # scroll up
-
- # define name of image file and search rect for ivy
- global gImageFile := "Stop";
- global gRect := pEndPointRect;
-
- StartTimerIV(); # start the timer
-
- _pressMouse();
- Wait(pWaitForScroll);
- _releasemouse();
-
- returnval := StopTimerIV(); # stop the timer
- #println "returnval from PerformScroll is ",returnval;
- return(returnval);
-
- end; # PerformScroll( pEndPointRect, pWhichDirection := 1)
-
- #########################################################################
- # TimeScrolling( pDocumentName, pIterations, pWhichDirection )
- #========================================================================
- # Author: MDS
- # Description: Times the scrolling of a document
- # Parameters: pDocumentName - name of the document in which to time scrolling
- # pIterations - how many iterations to time scrolling
- # pWhichDirection - in which direction to time scrolling:
- # 0 - Up, 1 - Down
- # pWaitForScroll - Time to wait with scroll arrow held down Note:
- # this should be longer than the scroll should take
- # so IVY has time to locate the image.
- # pHowEndScroll - How IVY will know when the scroll is complete
- # {string} - scroll is complete when {string} appears
- # - must be formatted in 12 point Geneva!
- # 1 - scroll is complete when thumbnail is at bottom of
- # scroll bar
- # pScrollByLine - whether to scroll line by line or screen by screen
- # 1 - line by line
- # 0 - screen by screen
- # Returns: The actual time that takes to scroll
- # Example:
- #========================================================================
- # History:
- # ML 3/31/94 Added IVInit and IVQuit, revised gTimedEvent
- # KTA 4/15/94 Added check to insure that IV initialized correctly
- # ML 5/27/94 add string, Thumbnail and scroll by screen option
- # ML 5/27/94 add pHowEndScroll, pScrollByLine
- # ML 5/27/94 calculate location of the scroll points based on location
- # of thumbnail
- # ML 6/28/94 call PerformScroll() multiple times and increment pWaitForScroll
- # if it isn't long enough
- # ML 11/29/94 Added Exception Handling support
- # ML 1/31/95 Use _Ivy calls
- #########################################################################
- TASK TimeScrolling( pDocumentName := "", pIterations := 1, pWhichDirection := 1,
- pWaitForScroll := 35, pHowEndScroll := "Stop", pScrollByLine :=1)
- begin
- global gScrollWindow;
- if (SetUpDocumentWindow( pDocumentName ))
- begin
- if (InitIvy())
- begin
- # Scroll to set up for getting end point image
- if (gScrollWindow) # hook for Apps that don't scroll normally
- Call( gScrollWindow, 'V', pWhichDirection, 1 );
- else
- ScrollWindow('V', pWhichDirection, 1 );
-
- # get the position of the pointer - should be on thumbnail center
- try match [mouse p:?ThumbCenter];
- catch theError
- ExceptionDispatcher(theError);
-
- if typeof (pHowEndScroll) = 'string' # if looking for string
- begin
- try match[window o:1 r:?theRect];
- catch theError
- ExceptionDispatcher(theError);
- logstr ("Endpoint image is '{pHowEndScroll}' in 12 point Geneva");
- waitingRect := LocateTheString(theRect, pHowEndScroll); # get it's location
- end;
- else # else calculate location of thumbnail
- begin
- logstr ("Endpoint image is the Thumbnail");
- # println "ThumbCenter is ", ThumbCenter;
- ThumbNailLeftCoord := ThumbCenter[1] - 9;
- ThumbNailRightCoord := ThumbCenter[1] - 4;
- ThumbNailTopCoord := ThumbCenter[2] - 9;
- ThumbNailBottomCoord := ThumbCenter[2] + 9;
- waitingRect := {ThumbNailLeftCoord, ThumbNailTopCoord, ThumbNailRightCoord,
- ThumbNailBottomCoord};
- end;
-
- # println "waitingRect is ",waitingRect;
-
- _Ivy (task IVCreateImageFile, {"Stop", waitingRect});
-
- # calculate the location of the scroll points
- if pScrollByLine
- begin
- if pWhichDirection
- HScrollCoord := ThumbCenter[2] + 16;
- else
- HScrollCoord := ThumbCenter[2] - 16;
- end; # if pScrollByLine
- else # else scroll by screen
- begin
- if pWhichDirection
- HScrollCoord := ThumbCenter[2] + 6;
- else
- HScrollCoord := ThumbCenter[2] - 6;
- end; # scroll by screen
-
- ScrollCoords := { ThumbCenter[1], HScrollCoord };
-
- # println "ScrollCoords is ", ScrollCoords;
-
- for i := 1 to pIterations
- begin
- tTime := 0;
- ScrollCounter := 1;
- while tTime = 0
- begin
- if ScrollCounter < 11
- begin
- waitTime := ScrollCounter * pWaitForScroll;
- #println "waitTime is ",waitTime;
- tTime := PerformScroll( pDocumentName, waitingRect, pWhichDirection, waitTime, pScrollByLine, ScrollCoords);
- ScrollCounter := ScrollCounter + 1;
- end; # if ScrollCounter < 11
- else
- begin
- tTime := -1; # bail out after 10 tries
- println "Unable to complete scroll with current pWaitForScroll parameters";
- end;
- end; # while tTime = 0
- end; # for i := 1 to pIterations
-
- _Ivy (task IVDeleteImageFile, {"Stop"});
- QuitIvy();
- end; # if (IVInit(1))
- else
- begin
- println "Problem initializing IV";
- exit;
- end;
- end; # if (SetUpDocumentWindow( pDocumentName ))
-
- end; # TimeScrolling( pDocumentName, pIterations )